/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.system.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 操作日志
 *
 * @since 2022/12/12 15:19
 */
@Data
@TableName("system_log")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "操作日志")
public class SystemLog extends Model<SystemLog> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 当操作会导致一系列其它日志时，标记为同一个logId
     */
    @ApiModelProperty(value = "当操作会导致一系列其它日志时，标记为同一个logId")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long logId;

    /**
     * 操作人类型（0系统、1用户、2管理人员）
     */
    @ApiModelProperty(value = "操作人类型（0系统、1用户、2管理人员）")
    private String operatorType;

    /**
     * 类型 SystemLogEnum.Type
     */
    @ApiModelProperty(value = "类型")
    private String type;

    /**
     * 旧数据
     */
    @ApiModelProperty(value = "旧数据")
    private String oldData;

    /**
     * 新数据
     */
    @ApiModelProperty(value = "新数据")
    private String newData;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    /**
     * 创建人id
     */
    @ApiModelProperty(value = "创建人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createBy;

    /**
     * 创建人名称
     */
    @ApiModelProperty(value = "创建人名称")
    private String createName;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间")
    private LocalDateTime updateTime;

    /**
     * 修改人id
     */
    @ApiModelProperty(value = "修改人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateBy;

    /**
     * 修改人名称
     */
    @ApiModelProperty(value = "修改人名称")
    private String updateName;

    /**
     * 状态（无意义）
     */
    @ApiModelProperty(value = "状态（无意义）")
    private String status;

    /**
     * 是否删除（0否、null是）
     */
    @TableLogic
    @ApiModelProperty(value = "是否删除（0否、null是）")
    private String isDeleted;
}
